package cn.itsource.configuration;


import cn.dev33.satoken.jwt.StpLogicJwtForStateless;
import cn.dev33.satoken.stp.StpLogic;
import cn.itsource.config.RedisConfig;
import cn.itsource.config.SaTokenConfigure;
import cn.itsource.config.StpInterfaceImpl;
import cn.itsource.config.TokenInterceptor;
import org.springframework.boot.autoconfigure.AutoConfigurationImportSelector;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@Import({RedisConfig.class})
public class AothAutoConfiguration {

    @Bean
    public SaTokenConfigure getSaTokenConfigure(){
        return new SaTokenConfigure();
    }
    @Bean
    public StpLogic getStpLogicJwt() {

        return new StpLogicJwtForStateless();
    }

    @Bean
    public StpInterfaceImpl getStpInterfaceImpl(){
        return new StpInterfaceImpl();
    }

    @Bean
    public TokenInterceptor getTokenInterceptor(){
        return new TokenInterceptor();
    }

    @Bean
    public PasswordEncoder passwordEncoder(){
        return new BCryptPasswordEncoder();
    }


}
